package com.example.hackergateway.exception;


import com.example.hackergateway.emun.HttpCodeEnum;

/**
 * Description：
 *
 * @Author: cw
 * CreateTime：2022-10-14
 */
public class CommonException extends RuntimeException {

    private static final long serialVersionUID = 469106984151721909L;

    private int code;

    private String message;

    public CommonException(int code, String message) {
        this.code = code;
        this.message = message;
    }
    public CommonException() {
        this.code = HttpCodeEnum.SERVER_ERROR.getCode();
        this.message = HttpCodeEnum.SERVER_ERROR.getMessage();
    }

    public CommonException(int code) {
        this.code = code;
        this.message = HttpCodeEnum.getByCode(code);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
